package spring.demo8.bean;

import java.io.Serializable;

public class StudentsBean implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 821063149957779952L;

	private Integer id;
	
	private String name;
	
	private int age;
	
	private String gengder;

	
	public StudentsBean() {
	}
	
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public int getGengder() {
		if (gengder == null || gengder.isEmpty())
			return 2;
		else if ("男".equals(gengder)) {
			return 1;
		}else if ("女".equals(gengder)) {
			return 0;
		}
		return 2;
	}

	public void setGengder(int gen) {
		
		
		this.gengder =  gen == 1 ? "男" : (gen == 0 ? "女" : "未知");
	}

	@Override
	public String toString() {
		return "StudentsBean [id=" + id + ", name=" + name + ", age=" + age + ", gengder=" + gengder + "]";
	}
	
	
}
